package com.example.myhelloworld.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HorizontalPanel;

public class DropExercise extends ExerciseClass{

	public DropExercise(String uName, String settings, GreetingServiceAsync GSA) {
		super(uName, settings, GSA);
		selfPanel = new HorizontalPanel();
		produceResultButton = new Button("Close");
		selfPanel.add(produceResultButton);
		selfPanel.addStyleName("ExerciseBasic");
		
		Button dropIt = new Button("Drop all exercises");
		selfPanel.add(dropIt);
		dropIt.addClickHandler(new ClickHandler(){		//just drops databases: 

			public void onClick(ClickEvent event) {
				gsa.dropDataBaseExercises(new AsyncCallback<String>(){
					public void onFailure(Throwable caught) {
						// TODO Auto-generated method stub
					}
					public void onSuccess(String result) {
						// TODO Auto-generated method stub
					}});
				
			}});
	}

	@Override
	public void draw() {
		
	}

	@Override
	public String pushresult() {
		return "";
	}

}
